package blazeConnection
{
	import mx.logging.ILogger;
	import mx.logging.Log;

	/**
	 * This class is used to generate the request to Blaze.
	 */
	public class BlazeRequest
	{
		public var _messageAgent:String="";
		public var _serviceId:String ="";
		public var _clientId:String ="";
		public var _destination:String ="";
		public var _subtopic:String ="";
		public var _consumer:String ="";
		public var _requestTimeout:int=0;
		public var _connectTimeout:int=0;
		private var _reconnectAttemps:int=0;
		public var _usePolling:Boolean;
		private var _abortOldMessages:Boolean;
		
		private var logger:ILogger = Log.getLogger("blazeConnection.BlazeRequest");    
    
		/**
		 * Initializes a new instance of the BlazeRequestCollection class.
		 * 
		 * @param	clientId
		 * @param	messageAgent
		 * @param	channelName
		 * @param	destination
		 * @param	usePolling
		 * @param	consumerName
		 * @param	myRequestTimeout
		 * @param	myConnectTimeout
		 * @param	abortOldMessages
		 */
		public function BlazeRequest(clientId:String, messageAgent:String, channelName:String, destination:String, subtopic:String, usePolling:Boolean, myRequestTimeout:int=0, myConnectTimeout:int=0, abortOldMessages:Boolean=true, _reconnectAttempsOption:int=-1)
		{
			_clientId = clientId;
			_messageAgent = messageAgent;
			_serviceId = channelName;
			_requestTimeout = myRequestTimeout;
			_connectTimeout = myConnectTimeout;
			_usePolling = usePolling;
			_destination = destination;
			_subtopic = subtopic;
			if (_usePolling) {				
				_abortOldMessages=abortOldMessages;
			}		
			_reconnectAttemps = _reconnectAttempsOption;
		}
		
		/**
		 * Get the value of the attribute abort old message
		 */
		public function get abortOldMessages():Boolean
		{
			return _abortOldMessages;
		}

		/**
		 * Set the value of the attribute abort old message
		 */
		public function set abortOldMessages(value:Boolean):void
		{
			_abortOldMessages = value;
		}

		/**
		 * Get the number of attempted reconnections
		 */
		public function get reconnectAttemps():int
		{
			return _reconnectAttemps;
		}

		/**
		 * Set the number the attemps reconnections
		 */
		public function set reconnectAttemps(value:int):void
		{
			_reconnectAttemps = value;
		}
	}
}